package com.ruoyi.ly.rabbitmq.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MQConfig {
    //声明交换机
    @Bean
    public Exchange fanoutExchange() {
        return ExchangeBuilder.fanoutExchange("fanout_sms").durable(true).build();
    }
    //声明队列
    @Bean
    public Queue fanoutQueue1() {
        return QueueBuilder.durable("fanout_sms_queue1").build();
    }
    //定义绑定关系
    @Bean
    public Binding fanoutBinding1() {
        return BindingBuilder.bind(fanoutQueue1()).to(fanoutExchange()).with("").noargs();
    }

}
